package io.github.jast90.internship.controller;

import io.github.jast90.common.form.CommonPageRequestBody;
import io.github.jast90.internship.entity.InternshipProgramEvaluation;
import io.github.jast90.internship.service.InternshipProgramEvaluationService;
import io.github.jast90.mybatis.pagination.domain.Page;
import io.github.jast90.mybatis.pagination.domain.PageRequest;
import io.github.jast90.web.common.controller.BaseController;
import io.github.jast90.web.common.result.CommonResult;
import org.springframework.web.bind.annotation.*;

/**
 * Created by jast90 on 2021/3/8
 */
@RestController
public class InternshipProgramEvaluationRestController extends BaseController<InternshipProgramEvaluationService, InternshipProgramEvaluation> {

    @PostMapping("internship/program/evaluation/page")
    @Override
    public CommonResult<Page<InternshipProgramEvaluation>> queryPage(@RequestBody CommonPageRequestBody<PageRequest, InternshipProgramEvaluation> requestBody) {
        return service.queryPage(requestBody.getPageRequest(),requestBody.getDomain());
    }

    @GetMapping("internship/program/evaluation/{id}")
    @Override
    public CommonResult<InternshipProgramEvaluation> queryById(@PathVariable("id") long id) {
        return service.queryById(id);
    }

    @PostMapping("internship/program/evaluation")
    @Override
    public CommonResult<InternshipProgramEvaluation> add(@RequestBody InternshipProgramEvaluation entity) {
        return service.add(entity);
    }

    @PutMapping("internship/program/evaluation")
    @Override
    public CommonResult<InternshipProgramEvaluation> update(@RequestBody InternshipProgramEvaluation entity) {
        return service.updateById(entity);
    }

    @DeleteMapping("internship/program/evaluation/{id}")
    @Override
    public CommonResult<InternshipProgramEvaluation> delete(@PathVariable("id") long id) {
        return service.deleteById(id);
    }
}
